import pkg from 'glob'
import fs from 'fs'
import { resolve } from 'path'
const { glob } = pkg

export const deletePages = () => {
  const allEntry = glob.sync('./src/**.html')
  return {
    name: 'rollupEnd',
    buildEnd () {
      allEntry.forEach(entry => {
        if (entry.indexOf('template') > 0) return
        fs.rm(resolve(__dirname, '../', entry), () => { })
      })
    }
  }
}
